package com.yoyoyo666.report.common;

public enum TaskTypeEnum {

    /*
activated 激活
assigned 分配
bugconfirmed 确认
closed 关闭
commented bug 添加备注
deleted 删除
deletedfile 删除文件
edited 编辑
linked2release 发布
opened 创建
resolved 解决
tostory bug 转需求
     */

    opened("opened", "创建", "创建"),
    finished("finished", "完成", "完成"),
    started("started", "开始", "开始"),
    assigned("assigned", "指派", "指派"),
    recordestimate("recordestimate", "记录工时", "记录工时"),
    edited("edited", "编辑", "编辑"),
    editestimate("editestimate", "编辑工时", "编辑工时"),
    deleteestimate("deleteestimate", "删除工时", "删除工时"),
    activated("activated", "激活", "激活"),
    canceled("canceled", "取消", "取消"),
    closed("closed", "关闭", "关闭"),
    ;
    private String key;
    private String value;
    private String comment;

    TaskTypeEnum(String key, String value, String comment) {
        this.key = key;
        this.value = value;
        this.comment = comment;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public String getComment() {
        return comment;
    }


    public static String getBugComment(String key) {
        if (key == null) {
            return null;
        }
        for (TaskTypeEnum activityUnitEnum : TaskTypeEnum.values()) {
            if (activityUnitEnum.getKey().equals(key)) {
                return activityUnitEnum.getComment();
            }
        }
        return null;
    }

    public static TaskTypeEnum getValueByType(String key) {
        if (key == null) {
            return null;
        }
        for (TaskTypeEnum activityUnitEnum : TaskTypeEnum.values()) {
            if (activityUnitEnum.getKey().equals(key)) {
                return activityUnitEnum;
            }
        }
        return null;
    }
}
